/**
 * 引入自定义指令
 * 注入Vue实例化中 Vue.use(key)
 */
import hasRole from './permission/hasRole'
import hasPermi from './permission/hasPermi'
import hasPermiAll from './permission/hasPermiAll'
import inputValue from './inputLimit/inputValue'
import watermark from './watermark/index'
import clipboard from './clipboard/index'
import preview from './preview/index'
import search from './search/index'

const install = function(Vue) {
  Vue.directive('hasRole', hasRole)
  Vue.directive('hasPermi', hasPermi)
  Vue.directive('hasPermiAll', hasPermiAll)
  Vue.directive('inputLimit', inputValue)
  Vue.directive('watermark', watermark)
  Vue.directive('clipboard', clipboard)
  Vue.directive('preview', preview)
  Vue.directive('search', search)
}

if (window.Vue) {
  window['hasRole'] = hasRole
  window['hasPermi'] = hasPermi
  window['hasPermiAll'] = hasPermiAll
  window['inputLimit'] = inputValue
  window['watermark'] = watermark
  window['clipboard'] = clipboard
  window['preview'] = preview
  window['search'] = search
  Vue.use(install); // eslint-disable-line
}

export default install
